CD ?= cd
RM ?= rm
LD ?= ld

TARGET=voxelands
PACKAGE=voxelands
VERSION=1602.00-alt

include Makefile.sources

CFLAG_DEFS=-DPACKAGE=\"$(PACKAGE)\" -DVERSION=\"$(VERSION)\" -DGAMEDATA=\"$(DATADIR)\"

DISTFILES=inc data README CHANGELOG LICENSE $(SRCDIR) Makefile.*

.SUFFIXES:
.SUFFIXES: .c .o .h

all: default

default: client server

client: $(TARGET)

server: $(TARGET)-server

dist-base:
	mkdir -p $(PACKAGE)-$(VERSION)
	cp -Rt $(PACKAGE)-$(VERSION) $(DISTFILES)

dist-gz: dist-base
	tar czf $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION)
	$(RM) -r $(PACKAGE)-$(VERSION)

dist-bz2: dist-base
	tar cjf $(PACKAGE)-$(VERSION).tar.bz2 $(PACKAGE)-$(VERSION)
	$(RM) -r $(PACKAGE)-$(VERSION)

dist: distclean dist-bz2

distclean:
	$(RM) $(OBJS)

clean: distclean
	$(RM) $(PACKAGE)*

fresh: clean all

.c.o: inc/common.h
	$(CC) $(TARGET_CFLAGS) $(CFLAG_DEFS) -o $@ -c $<

.PHONY: all default client server dist-base dist-gz dist-bz2 dist distclean clean fresh
